<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <style>

    </style>
</head>

<body>
    <div id="app">
        <my-header :title="tit1" :content="content1"></my-header>
        <my-header :title="tit2" :content="content2"></my-header>
    </div>
</body>

<template id="tmpl"> 
    <div>
        <!-- 父组件的 titl和content 数据会被传递到这里 -->
        <h1>{{title}}</h1>
        <h2>{{content}}</h2>
    </div>
</template>

<script>
    var vm = new Vue({
        el: '#app',
        data: {
            tit1: '分类',
            tit2: '购物车',
            content1: '内容1',
            content2: '内容2'
        },
        components: {
            'my-header': {
                template: '#tmpl',
                props: ['title', 'content']
            }
        }
    })
</script>

</html>